package com.demo.mq.rabbit.consumer.service;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * Created with intelliJ Idea
 *
 * @Author: ysw
 * @Date: 2021-12-18 14:21
 * @Description: 消费者监听类
 */
@Component
public class DirectReceiver {

    @RabbitHandler
    @RabbitListener(queues = "TestDirectQueue")
    public void process1(Map msg){
        System.out.println("1收到 DirectQueue 消息:"+ msg.toString());
    }

    @RabbitHandler
    @RabbitListener(queues = "TestDirectQueue")
    public void process2(Map msg){
        System.out.println("2收到 DirectQueue 消息:"+ msg.toString());
    }

    @RabbitHandler
    @RabbitListener(queues = {"topic.woman","fanout.A"})
    public void process(Map testMessage) {
        System.out.println("TopicTotalReceiver消费者收到消息  : " + testMessage.toString());
    }

    @RabbitHandler

    @RabbitListener(queues = {"topic.man","fanout.C"})
    public void processman(Map testMessage) {
        System.out.println("TopicManReceiver消费者收到消息  : " + testMessage.toString());
    }
}
